<?php
/**
 * Date: 2020/3/17
 * Time: 19:08
 * Author: 北京永青宇创科技有限公司
 * +---------------------------------------------------------------
 * | CopyRight: 北京永青宇创科技有限公司 All rights reserved.
 * +---------------------------------------------------------------
 * | 版权声明：云豹不是一个自由软件，是云豹官方推出的商业源码。
 * | 严禁在未经许可的情况下拷贝、复制、传播、使用云豹的任意代码
 * | 如有违反，请立即删除，否则您将面临承担相应，法律责任的风险。
 * | 如果需要取得官方授权，请联系官方 https://www.gepardshop.com
 * +---------------------------------------------------------------
 */

namespace app\mall\controller;

class Goods extends MallHome {
	public function index($id = 0)
	{

		$goods_info = $this->assignOneGood($id);
		$this->assignGoodsOrder($id);
		$this->assignGoods($goods_info['price']);

		$goods_price_sort = model('mall/mallGoods')->where('status',1)->where('price','between',[($goods_info['price']-200),($goods_info['price']+200)])->order('num_stock desc,id desc')->limit(4)->select();
		$this->assign('goods_price_sort', $goods_price_sort);

		$goods_recommend = model('mall/mallGoods')->where(['status'=>1,'category_id'=>$goods_info['category_id']])->order('num_stock desc,id desc')->limit(6)->select();
		$this->assign('recommend', $goods_recommend);

		return $this->fetch();
	}
}